package com.hz.tgb.response.restful;

/**
 * 处理结果响应代码
 *
 * @author hezhao on 2019/8/28 17:59
 */
public enum ResponseCode implements AppCode {
    RESOURCE_NOT_FOUND(404, "资源不存在"),
    UNKOWN_EXCEPTION(-1, "系统压力山大,请稍后重试！"),
    SUCCESS(0, "OK"),
    INSERT_EXCEPTION(10, "数据新增失败！"),
    INSERT_BATCH_EXCEPTION(11, "数据新增失败！"),
    UPDATE_EXCEPTION(20, "数据更新失败！"),
    DELETE_EXCEPTION(30, "数据删除失败！"),
    DISABLE_EXCEPTION(31, "使数据无效失败！"),
    SELECT_ONE_EXCEPTION(40, "数据获取失败！"),
    SELECT_EXCEPTION(41, "数据获取失败！"),
    SELECT_PAGINATION_EXCEPTION(42, "数据获取失败！"),
    INVALID_SYSTEM_CLOCK(10101, "系统时间回调到当前时间之前的时间点，拒绝产生ID%d毫秒"),
    UNKOWN_WORKER_ID(10102, "无法获取IdWorker标识"),
    INVALID_WORKER_ID(10103, "无效IdWorker标识，%d > %d"),
    UNKOWN_ELASTICSEARCH_BEAN(43, "无效获取elasticsearch实现bean"),

    USER_LOGIN_NULL(10104,"请登录后再操作"),
    DATABASE_ERROR(10105,"数据库操作失败" ),
    PARAMETER_NULL(10106,"参数必填不能为空"),
    PARAMETER_ID_NULL(10107,"参数ID不能为空"),
    SYSTEM_ERROR(10108,"系统异常"),
    ID_NUMBER_NULL(10109,"获取流水编码失败！"),
    PUSH_MQ_MESSAGE_ERROR(10110, "操作失败, 推送数据至消息队列出错"),

    ;

    private int code;
    private String message;

    private ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String toString() {
        return Integer.toString(getCode());
    }

    /**
     * @return the message
     */
    @Override
    public String getMessage() {
        return message;
    }

    /**
     * @return the code
     */
    @Override
    public int getCode() {
        return code;
    }

}
